package org.jsbd.boss.action;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.jsbd.boss.common.ResponseUtils;
import org.jsbd.boss.domian.channel.VerInfo;
import org.jsbd.boss.service.IApkSimulatorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.alibaba.fastjson.JSONArray;

@Controller
@RequestMapping("/simulator")
public class ApkSimulatorController {
	public static final Logger LOGGER = LoggerFactory.getLogger(ApkSimulatorController.class);

	@Resource
	private IApkSimulatorService apkSimulatorService;

	/**
	 * 
	 * selectVers:获取选择的版本
	 * @author <a href="mailto:xupengcheng@zhexinit.com" >徐鹏程</a>
	 * @param response
	 * @param verType
	 * @param mark
	 */
	@RequestMapping(value = "verList", method = RequestMethod.GET)
	public void selectVers(HttpServletResponse response, String verType, String mark) {
		List<VerInfo> list = apkSimulatorService.selectVers(mark, verType);
		ResponseUtils.renderJson(response, JSONArray.toJSONString(list));
	}

	@RequestMapping(value = "taskVerList", method = RequestMethod.GET)
	public void selectVers(HttpServletResponse response, Long taskverId) {
		List<VerInfo> list = apkSimulatorService.selectVers(taskverId);
		ResponseUtils.renderJson(response, JSONArray.toJSONString(list));
	}

}
